﻿namespace Arms.Persistence.Modules.Geography.Mappings
{
    using Arms.Domain.Modules.Geography;
    using System;

    internal class PlaceMap : PointBaseMap<Place>
    {
        public PlaceMap()
            : base()
        {
            HasMany(x => x.PlaceTypes).WithMany(x => x.Places).Map(x =>
            {
                x.ToTable("Place_PlaceTypes");
                x.MapLeftKey("PlaceID");
                x.MapRightKey("PlaceTypeID");
            });

            HasMany(x => x.Contacts).WithMany(x => x.Places).Map(x =>
            {
                x.ToTable("Place_Contacts");
                x.MapLeftKey("PlaceID");
                x.MapRightKey("ContactID");
            });
        }
    }
}
